package com.yishusmt.mobsmt.controller;

import com.yishusmt.mobsmt.dto.response.UserRes;
import com.yishusmt.mobsmt.entity.UserEntity;
import com.yishusmt.mobsmt.mapper.UserInfoMapper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;

import javax.annotation.Resource;

/**
 * 根据token解析用户信息
 *
 * @author zhangyi
 * @date 2018/8/13 13:16
 */
@Controller
public class BaseController {

   @Resource
   private UserInfoMapper userInfoMapper;

   @ModelAttribute
   public UserRes getUser(String phone){
       if(phone != null) {
           return userInfoMapper.selectUserSelective(phone);
       }
       return null;
   }
}
